package org.tigris.subversion.svnant.commands;

import java.io.File;
import java.util.Date;
import org.apache.tools.ant.Project;
import org.tigris.subversion.svnant.SvnAntUtilities;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.ISVNStatus;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNRevision.Number;
import org.tigris.subversion.svnclientadapter.SVNStatusKind;
import org.tigris.subversion.svnclientadapter.SVNUrl;

public class Status extends SvnCommand
{
  private static final String MSG_CANT_GET_STATUS = "Can't get status of %s";
  private File path = null;
  private String textStatusProperty = null;
  private String propStatusProperty = null;
  private String revisionProperty = null;
  private String lastChangedRevisionProperty = null;
  private String lastChangedDateProperty = null;
  private String lastCommitAuthorProperty = null;
  private String urlProperty = null;

  public void execute()
  {
    Project localProject = getProject();
    try
    {
      ISVNStatus localISVNStatus = getClient().getSingleStatus(this.path);
      if (this.textStatusProperty != null)
        localProject.setProperty(this.textStatusProperty, localISVNStatus.getTextStatus().toString());
      if (this.propStatusProperty != null)
        localProject.setProperty(this.propStatusProperty, localISVNStatus.getPropStatus().toString());
      Object localObject;
      if (this.revisionProperty != null)
      {
        if (null == localISVNStatus.getRevision())
          localObject = "-1";
        else
          localObject = localISVNStatus.getRevision().toString();
        localProject.setProperty(this.revisionProperty, (String)localObject);
      }
      if (this.lastChangedRevisionProperty != null)
      {
        if (localISVNStatus.getLastChangedRevision() == null)
          localObject = "";
        else
          localObject = localISVNStatus.getLastChangedRevision().toString();
        localProject.setProperty(this.lastChangedRevisionProperty, (String)localObject);
      }
      if (this.lastCommitAuthorProperty != null)
      {
        localObject = localISVNStatus.getLastCommitAuthor();
        if (localObject == null)
          localObject = "";
        localProject.setProperty(this.lastCommitAuthorProperty, (String)localObject);
      }
      if (this.lastChangedDateProperty != null)
      {
        localObject = localISVNStatus.getLastChangedDate();
        if (localObject == null)
          localProject.setProperty(this.lastChangedDateProperty, "");
        else
          localProject.setProperty(this.lastChangedDateProperty, getDateStringFor((Date)localObject));
      }
      if (this.urlProperty != null)
      {
        localObject = localISVNStatus.getUrl();
        localProject.setProperty(this.urlProperty, localObject != null ? ((SVNUrl)localObject).toString() : "");
      }
    }
    catch (SVNClientException localSVNClientException)
    {
      throw ex(localSVNClientException, "Can't get status of %s", new Object[] { this.path });
    }
  }

  protected void validateAttributes()
  {
    SvnAntUtilities.attrNotNull("path", this.path);
  }

  public void setPath(File paramFile)
  {
    this.path = paramFile;
  }

  public void setTextStatusProperty(String paramString)
  {
    this.textStatusProperty = paramString;
  }

  public void setPropStatusProperty(String paramString)
  {
    this.propStatusProperty = paramString;
  }

  public void setRevisionProperty(String paramString)
  {
    this.revisionProperty = paramString;
  }

  public void setLastChangedRevisionProperty(String paramString)
  {
    this.lastChangedRevisionProperty = paramString;
  }

  public void setLastCommitAuthorProperty(String paramString)
  {
    this.lastCommitAuthorProperty = paramString;
  }

  public void setLastChangedDateProperty(String paramString)
  {
    this.lastChangedDateProperty = paramString;
  }

  public void setUrlProperty(String paramString)
  {
    this.urlProperty = paramString;
  }
}

/* Location:           C:\Users\Administrator\Desktop\svnant.jar
 * Qualified Name:     org.tigris.subversion.svnant.commands.Status
 * JD-Core Version:    0.6.0
 */